/*******************************************************************************
 * $Header: /cvsroot/oloa/org.gocom.bpm.platform.model/src/org/gocom/bpm/platform/model/web/taglib/Text.java,v 1.1 2011/07/03 02:30:16 hufulai Exp $
 * $Revision: 1.1 $
 * $Date: 2011/07/03 02:30:16 $
 *
 *==============================================================================
 *
 * Copyright (c) 2001-2006 Primeton Technologies, Ltd.
 * All rights reserved.
 * 
 * Created on 2010-5-26
 *******************************************************************************/

package com.atozsoft.wf.taglib;

import org.w3c.dom.Element;

public class Text
{
    public String m_value;
    public int m_height;
    public int m_width;
    public String m_fontName;
    public int m_fontWidth;
    public int m_fontSize;
    public boolean m_isItalic;
    public boolean m_isUnderLine;
    public int m_x;
    public int m_y;
    
    
    public Text(Element ele)
    {
        m_value = null;
        m_height = 0;
        m_width = 0;
        m_fontName = null;
        m_fontWidth = 0;
        m_fontSize = 0;
        m_isItalic = false;
        m_isUnderLine = false;
        m_x = 0;
        m_y = 0;
        m_fontName = ele.getAttribute("fontName");
        m_fontSize = Integer.parseInt(ele.getAttribute("fontSize"));
        m_fontWidth = Integer.parseInt(ele.getAttribute("fontWidth"));
        m_isItalic = !"0".equals(ele.getAttribute("isItalic"));
        m_isUnderLine = !"0".equals(ele.getAttribute("isUnderLine"));
        m_height = Integer.parseInt(ele.getAttribute("textHeight"));
        m_width = Integer.parseInt(ele.getAttribute("textWidth"));
        if(ele.getFirstChild() != null)
        {
            m_value = ele.getFirstChild().getNodeValue();
            m_value = m_value.trim();
        }
        if(m_value != null)
            m_width = m_fontSize * m_value.getBytes().length;
        else
            m_width = 0;
        if(ele.getAttribute("textx") != null && !"".equals(ele.getAttribute("textx")))
            m_x = Integer.parseInt(ele.getAttribute("textx"));
        if(ele.getAttribute("texty") != null && !"".equals(ele.getAttribute("texty")))
            m_y = Integer.parseInt(ele.getAttribute("texty"));
    }


}
